package cn.bbs.ba.mail;

import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;

import cn.bbs.ba.path.BasePath;

public class SendMail {
	
	private static String HOST_NAME = BasePath.getPath("email_hostName");
	private static String EMAIL_NAME = BasePath.getPath("email_userName");
	private static String EMAIL_PWD = BasePath.getPath("email_pwd");
	
	public static int send(String strTitle, String strValue, String strGat)        
    {        
        SimpleEmail email = new SimpleEmail();           
        email.setTLS(true);                
        email.setHostName(HOST_NAME);              
        email.setAuthentication(EMAIL_NAME, EMAIL_PWD);   //�û��������        
                
        try         
        {        
            email.addTo(strGat); //���շ�     
            email.setFrom(EMAIL_NAME);       
            //email.addCc("lianmeng_zzz@126.com"); //���ͷ�       
            //email.addBcc("lianmeng_zzz@126.com"); //���ܳ��ͷ�   
            
            email.setCharset("UTF-8");          
            email.setSubject(strTitle);         //����        
            email.setMsg(strValue);   //����  
            email.send();         
                    
        } catch (EmailException e) {    
        	e.printStackTrace();
            return -1;       
        }
		return 0;         
    }      
	
	public static void main(String stra[]) {
		//send();
	}

	
}
